//
//  OMConsumerListHeader.m
//  OMENGO
//
//  Created by 梁尚嘉 on 2017/3/6.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "OMConsumerListHeader.h"
#import "MainConfigure.h"
@implementation OMConsumerListHeader {
    UILabel *_titleLabel;
}

- (void)setTitle:(NSString *)title
{
    _titleLabel.text = title;
}


//- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier
//{
//    self = [super initWithReuseIdentifier:reuseIdentifier];
//    [self configure];
//    return self;
//}

- (instancetype)init
{
    self = [super init];
    [self configure];
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    [self configure];
    return self;
}

- (void)configure
{
//    self.contentView.backgroundColor = [UIColor clearColor];
//    self.backgroundColor = [UIColor clearColor];
//    self.superview.backgroundColor = [UIColor clearColor];

//    self.blurRadius = 20;
//    self.alpha = 1;
//    self.tintColor = SM_blackColor;
//    self.dynamic = YES;
//    self.blurEnabled = NO;
    self.backgroundColor = [SM_whiteColor colorWithAlphaComponent:.95];

    _titleLabel = [UILabel new];
    _titleLabel.font = SM_CFont(31);
    _titleLabel.textColor = SM_blackColor;
//    _titleLabel.backgroundColor = HEXCOLOR(@"#F7F7F7");
    [self addSubview:_titleLabel];


    UIView *bar = [UIView new];
    bar.backgroundColor = SM_thumeColor;
    [self addSubview:bar];
    [bar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(SM_SIZE(30)));
        make.top.equalTo(_titleLabel.mas_top).offset(SM_SIZE(5));
        make.bottom.equalTo(_titleLabel.mas_bottom).offset(SM_SIZE(-5));
        make.width.equalTo(@(SM_SIZE(5)));
    }];

    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bar.mas_right).offset(SM_SIZE(10));
        make.centerY.equalTo(self.mas_centerY);
    }];

    UIView *lineV = [UIView new];
    lineV.backgroundColor = HEXCOLOR(@"e4e4e4");
    [self insertSubview:lineV atIndex:0];
    [lineV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@0);
        make.left.right.equalTo(@0);
        make.height.equalTo(@(1.f/[UIScreen mainScreen].scale));
    }];


}

+ (NSString *)identifier
{
    return NSStringFromClass(self.class);
}

@end
